#局部变量和全局变量
#规则1: 局部变量和全局变量是不同变量
n, s = 10, 100
def fact(n):
    s = 1
    for i in range(1, n + 1):
        s *= i
    return s
print(fact(n), s)

n, s = 10, 100
def fact(n):
    global s
    for i in range(1, n + 1): 
        s *= i
    return s
print(fact(n), s)

#规则2: 局部变量为组合数据类型且未创建，等同于全局变量
Is = ["F", "f"]
def func(a):
    Is.append(a)
    return
func("C")
print(Is)